//
//  HMSportMapModeViewController.m
//  HMBest22
//
//  Created by Apple on 17/1/13.
//  Copyright © 2017年 Apple. All rights reserved.
//

#import "HMSportMapModeViewController.h"

@interface HMSportMapModeViewController ()
@property (nonatomic, strong) UIButton*selectBtn;
@property (strong, nonatomic) IBOutletCollection(UIButton) NSArray *mapButtons;

@end

@implementation HMSportMapModeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    for (UIButton *btn in _mapButtons) {
        btn.selected = (btn.tag == self.currentMapType);
    }
}

- (IBAction)changeMapType:(UIButton *)sender
{
    // 优化代码  当用户连续点击时,就不需要再去切换地图类型
    if (sender.tag == self.currentMapType) {
        return;
    }
    
    self.currentMapType = sender.tag;
    // 修改地图类型
    self.selectMapMode(sender.tag);
//    self.selectBtn.selected = NO;
//    self.selectBtn = sender;
//    self.selectBtn.selected = YES;
    for (UIButton *btn in _mapButtons) {
        btn.selected = (btn == sender);
    }
}

@end
